package com.sky.mapper.admin;


import com.github.pagehelper.Page;
import com.sky.dto.EmployeeDTO;
import com.sky.dto.EmployeePageQueryDTO;
import com.sky.pojo.Employee;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;


public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    /**
     * 新增员工
     * @param employee
     */
    @Insert("insert into employee(name, username, password, phone, sex, id_number, create_time, update_time, create_user, update_user) values (#{name},#{username},#{password},#{phone},#{sex},#{idNumber},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void addEmployee(Employee employee);

    /**
     * 员工分页查询
     * @param employeePageQueryDTO
     * @return
     */
    List<Employee> employeePaginationQuery(EmployeePageQueryDTO employeePageQueryDTO);

    /**
     * 启用禁用员工账号
     * @param status
     * @return
     */
    void enableAndDisableEmployeeAccounts(Integer status,Long id);

    /**
     * 根据ID查询员工，数据回显
     * @param id
     * @return
     */
    @Select("select * from employee where id = #{id}")
    Employee searchEmployeeById(Long id);

    /**
     * 根据id修改员工
     * @return
     */
    void modifyEmployeesById(Employee employee);
}
